<!DOCTYPE html>
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>highlight_django.html</title>
<meta name="generator" content="KF5::SyntaxHighlighting - Definition (Django HTML Template) - Theme (Breeze Light)"/>
</head><body style="background-color:#ffffff;color:#1f1c1b"><pre>
{# Basic extension of a common file #}
<span style="color:#644a9b;">{% extends</span><span style="color:#644a9b;"> </span><span style="color:#bf0303;">&quot;base_file.html&quot;</span><span style="color:#644a9b;"> </span><span style="color:#644a9b;">%}</span>

<span style="color:#644a9b;">{% block</span><span style="color:#644a9b;"> title </span><span style="color:#644a9b;">%}</span><span style="color:#644a9b;">{{ section.title }}</span><span style="color:#644a9b;">{% endblock %}</span>

<span style="color:#644a9b;">{% block</span><span style="color:#644a9b;"> content </span><span style="color:#644a9b;">%}</span>
<span style="font-weight:bold;">&lt;h1&gt;</span><span style="color:#644a9b;">{{ section.title }}</span><span style="font-weight:bold;">&lt;/h1&gt;</span>

{# For loop example #}

<span style="color:#644a9b;">{% for</span><span style="color:#644a9b;"> item in item_list </span><span style="color:#644a9b;">%}</span>
<span style="font-weight:bold;">&lt;h2&gt;</span>
  <span style="font-weight:bold;">&lt;a</span><span style="color:#006e28;"> href=</span><span style="color:#bf0303;">&quot;</span><span style="color:#644a9b;">{{ item.get_absolute_url }}</span><span style="color:#bf0303;">&quot;</span><span style="font-weight:bold;">&gt;</span>
    <span style="color:#644a9b;">{{ item.text }}</span>
    <span style="color:#644a9b;">{{ item.other_text</span><span style="color:#006e28;">|upper </span><span style="color:#644a9b;">}}</span>
  <span style="font-weight:bold;">&lt;/a&gt;</span>
<span style="font-weight:bold;">&lt;/h2&gt;</span>
<span style="font-weight:bold;">&lt;p&gt;</span><span style="color:#644a9b;">{{ story.longer_text</span><span style="color:#006e28;">|truncatewords:</span><span style="color:#bf0303;">&quot;100&quot;</span><span style="color:#006e28;"> </span><span style="color:#644a9b;">}}</span><span style="font-weight:bold;">&lt;/p&gt;</span>
<span style="color:#644a9b;">{% endfor %}</span>
<span style="color:#644a9b;">{% endblock %}</span>


{# For loop example with specific content if empty #}

<span style="color:#644a9b;">{% for</span><span style="color:#644a9b;"> item in other_list </span><span style="color:#644a9b;">%}</span>
<span style="font-weight:bold;">&lt;h2&gt;</span>
	<span style="color:#644a9b;">{{ item.text }}</span>
<span style="font-weight:bold;">&lt;/h2&gt;</span>
<span style="color:#644a9b;">{% else</span><span style="color:#644a9b;"> </span><span style="color:#644a9b;">%}</span>
<span style="font-weight:bold;">&lt;h2&gt;</span>
	This list is empty
<span style="font-weight:bold;">&lt;/h2&gt;</span>
<span style="color:#644a9b;">{% endfor %}</span>
<span style="color:#bf0303;text-decoration:underline;">{% endblock %}</span>


{# if example #}

<span style="color:#644a9b;">{% if</span><span style="color:#644a9b;"> item_list </span><span style="color:#644a9b;">%}</span>
    Number of items: <span style="color:#644a9b;">{{ item_list</span><span style="color:#006e28;">|length </span><span style="color:#644a9b;">}}</span>
<span style="color:#644a9b;">{% elif</span><span style="color:#644a9b;"> some_condition </span><span style="color:#644a9b;">%}</span>
    Show this text
<span style="color:#644a9b;">{% else</span><span style="color:#644a9b;"> </span><span style="color:#644a9b;">%}</span>
    Nothing to process
<span style="color:#644a9b;">{% endif %}</span>

{# This is a comment #} hello comment


{# Translation example #}

<span style="color:#644a9b;">{% translate</span><span style="color:#644a9b;"> </span><span style="color:#bf0303;">&quot;Title&quot;</span><span style="color:#644a9b;"> as title </span><span style="color:#644a9b;">%}</span>
<span style="color:#644a9b;">{% block</span><span style="color:#644a9b;"> content </span><span style="color:#644a9b;">%}</span><span style="color:#644a9b;">{{ title }}</span><span style="color:#644a9b;">{% endblock %}</span>


{# Auto-escaping #}

<span style="color:#644a9b;">{% autoescape</span><span style="color:#644a9b;"> off </span><span style="color:#644a9b;">%}</span>
    Hello <span style="color:#644a9b;">{{ name }}</span>
<span style="color:#644a9b;">{% endautoescape %}</span>


{# Loading custom tags/libraries #}

<span style="color:#644a9b;">{% load</span><span style="color:#644a9b;"> humanize </span><span style="color:#644a9b;">%}</span>
</pre></body></html>
